package webdemo;

import java.util.logging.Handler;
import java.util.logging.Level;
import java.util.logging.Logger;

public class LoggingThreadGroup extends ThreadGroup {

	private static Logger logger;
	
	public LoggingThreadGroup(String name) {
		super(name);
	}
	
	public void uncaughtException(Thread t, Throwable e){
		if(logger == null){
			logger = Logger.getLogger("example");
			Handler handler = LoggingWindowHandler.getInstance();
			Handler tmp = TmpHandler.getInstance();
			logger.addHandler(handler);
			logger.addHandler(tmp);
		}
		logger.log(Level.WARNING, t.getName(), e);
	}

	
}
